package com.fishleap.loadbalance;

import java.util.List;
import java.util.Random;

/**
 * @author zlg
 * 随机负载均衡算法
 */
public class RandomLoadBalance extends AbstractLoadBalance {

    // 随机负载均衡算法
    @Override
    protected String doSelect(List<String> serviceAddresses) {
        Random random = new Random();
        return serviceAddresses.get(random.nextInt(serviceAddresses.size()));
    }
}
